using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DreamBuilder.Common;

namespace Web
{
    public partial class MasterPage : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            lblMessage.Text = CResManager.GetPublicString("string", "Status");
            if (!this.Page.ClientScript.IsClientScriptBlockRegistered("jQuery"))
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "jQuery", GetJqueryRegisterScript()); 
            if (!this.Page.ClientScript.IsClientScriptBlockRegistered("RiaFrame"))
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "RiaFrame", GetFiaFrameRegisterScript());
            if (!this.Page.ClientScript.IsClientScriptBlockRegistered("UserControls"))
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "UserControls", GetUserControlRegisterScript());
            if (!this.Page.ClientScript.IsClientScriptBlockRegistered("CheckBox"))
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "CheckBox", GetCheckBoxRegisterScript());
            if (!this.Page.ClientScript.IsClientScriptBlockRegistered("DropDownList"))
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "DropDownList", GetDropDownListRegisterScript());
            if (!this.Page.ClientScript.IsClientScriptBlockRegistered("Menu"))
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "Menu", GetToolBarRegisterScript());
            if (!this.Page.ClientScript.IsClientScriptBlockRegistered("Tab"))
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "Tab", GetTabRegisterScript());
        }

        public string StatusMessage
        {
            set
            {
                lblMessage.Text = value;
            }
            get
            {
                return lblMessage.Text;
            }
        }
        public bool ShowStatusLabel
        {
            set
            {
                lblMessage.Visible = value;
            }
            get
            {
                return lblMessage.Visible;
            }
        }

        private string GetJqueryRegisterScript()
        {
            string script = "<script language=JavaScript src=\"" + System.Web.HttpContext.Current.Request.ApplicationPath + "/Javascript/jquery-1.5.2.min.js\" charset=\"utf-8\"></script>";
            return script;
        }

        private string GetFiaFrameRegisterScript()
        {
            string script = "<script language=JavaScript src=\"" + System.Web.HttpContext.Current.Request.ApplicationPath + "/Javascript/RiaFrame_Base.js\" charset=\"utf-8\"></script>";
            return script;
        }

        private string GetUserControlRegisterScript()
        {
            string script = "<script language=JavaScript src=\"" + System.Web.HttpContext.Current.Request.ApplicationPath + "/Javascript/UserControls.js\" charset=\"utf-8\"></script>";
            return script;
        }
        private string GetCheckBoxRegisterScript()
        {
            string script = "<script language=JavaScript src=\"" + System.Web.HttpContext.Current.Request.ApplicationPath + "/Javascript/CheckBox.js\" charset=\"utf-8\"></script>";
            return script;
        }
        private string GetDropDownListRegisterScript()
        {
            string script = "<script language=JavaScript src=\"" + System.Web.HttpContext.Current.Request.ApplicationPath + "/Javascript/DropDownList.js\" charset=\"utf-8\"></script>";
            return script;
        }

        private string GetToolBarRegisterScript()
        {
            string script = "<script language=JavaScript src=\"" + System.Web.HttpContext.Current.Request.ApplicationPath + "/Javascript/Menu.js\" charset=\"utf-8\"></script>";
            return script;
        }
        private string GetTabRegisterScript()
        {
            string script = "<script language=JavaScript src=\"" + System.Web.HttpContext.Current.Request.ApplicationPath + "/Javascript/Tab.js\" charset=\"utf-8\"></script>";
            return script;
        }

    }
}
